<?php
/**
 * @name SampleModel
 * @desc sample数据获取类, 可以访问数据库，文件，其它系统等
 * @author root
 */
class IndexModel
{
    public function __construct() 
    {
    	$this->db = Yaf_Registry::get('db');
    }
    /* 
        //执行一条SQL语句
        $this->db->query($sql, $parameters = array(), $fetchmode = PDO::FETCH_ASSOC);
        
        //插入一条记录
        $this->db->insert($tableName, array $data);

        //插入多条记录
        $this->db->insertBatch($tableName, array $data);

        //获取插入的最后ID值
        $this->db->lastInsertId();

        //更新
        $this->db->update($tableName, array $where, array $data, array $other=array());

        //删除
        $this->db->delete($tableName, array $where, array $other=array());

    */
    public function getIndex()
    {
        $sql = "select * from user ";
    	return $this->db->query($sql);
    }
    
    public function selectSample() 
    {
        return 'Hello World!';
    }

    public function insertSample($arrInfo) 
    {
        return true;
    }
    
}
